import { Blog } from "../model/Blog.js";



const fn_list = async(ctx,next) =>{
    let blogs = await Blog.findAll();
    ctx.body={
        code:1000,
        msg:'列表成功',
        data:blogs
    }
}
const fn_getById = async(ctx,next)=>{
    console.log(ctx.body);
    
    ctx.body = '指定博客';
}

const fn_add = async(ctx,next)=>{
   
    
    ctx.body = '新增';
}

const fn_edit = async(ctx,next)=>{
    ctx.body = '修改';
}

const fn_del = async(ctx,next)=>{
    ctx.body = '删除';
}

export default[
    {
        method:'get',
        url:'/blogs',
        fn:fn_list
    },
    {
        method:'get',
        url:'/blogs/:id',
        fn:fn_getById
    },
    {
        method:'post',
        url:'/blogs',
        fn:fn_add
    },
    {
        method:'put',
        url:'/blogs/:id',
        fn:fn_edit
    },
    {
        method:'del',
        url:'/blogs/:id',
        fn:fn_del
    }
]